package com.ying.user.config;

import com.ying.common.entity.ResponseCode;
import com.ying.user.utils.ResponseUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.web.access.AccessDeniedHandler;

@Configuration
public class SecurityHandlerConfig {

    @Bean
    public AccessDeniedHandler accessDeniedHandler() {
        return (request, response, accessDeniedException) -> ResponseUtils.renderJson(response, ResponseCode.ACCESS_DENIED, null);
    }

}